package com.speech.utils;

import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.support.v4.app.ActivityCompat;
import android.telephony.TelephonyManager;

import com.speech.activity.LoginActivity;

import pub.devrel.easypermissions.EasyPermissions;

public class DeviceUtil {


    public static String getDeviceID(Activity context) {
        String strDeviceID = null;

        if (!EasyPermissions.hasPermissions(context, Manifest.permission.READ_PHONE_STATE)) {
            EasyPermissions.requestPermissions(context, "为了获取设备号作为用户唯一标识", 1, Manifest.permission.READ_PHONE_STATE);
        }else {
            TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            strDeviceID = manager.getDeviceId();
        }

        return strDeviceID;
    }

}
